package com.woniu.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.common.utils.PageData;
import com.woniu.common.utils.ResponseData;
import com.woniu.order.pojo.ZfOrder;
import com.woniu.order.service.ZfOrderService;
import com.woniu.order.mapper.ZfOrderMapper;
import com.woniu.order.service.ZfTraderdetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author HP
* @description 针对表【zf_order(订单表)】的数据库操作Service实现
* @createDate 2024-11-25 15:55:43
*/
@Service
public class ZfOrderServiceImpl extends ServiceImpl<ZfOrderMapper, ZfOrder>
    implements ZfOrderService{
    @Autowired
    private ZfOrderMapper zfOrderMapper;
    @Autowired
    private ZfTraderdetailsService zfTraderdetailsService;

    /**
     * 分页查询
     * @param pageData
     * @return
     */
    @Override
    public ResponseData<?> queryAllPage(PageData<ZfOrder> pageData) {
        PageHelper.startPage(pageData.getPageNum(), pageData.getPageSize());
        List<ZfOrder> list = zfOrderMapper.queryAllPage(pageData.getParam());
        PageInfo pageInfo = new PageInfo(list);
        return new ResponseData<>().ok(pageInfo);
    }

    @Override
    public ResponseData<?> batchDelete(List<String> ids) {
        zfOrderMapper.batchDelete(ids);
        zfTraderdetailsService.batchDelete(ids);
        return new ResponseData<>().ok();
    }
}